package com.zyy.singleton;

/**
 * @Description: 类描述
 * @Author: zyy
 * @Date: 2023/07/19 00:08
 */
public class Holder {
    private Holder() {

    }

    public static Holder getInstance() {
        return InnerClass.HOLDER;
    }

    /**
     * 静态内部类
     */
    public static class InnerClass {
        private static final Holder HOLDER = new Holder();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                Holder instance = Holder.getInstance();
                System.out.println(instance);
            }).start();

        }
    }
}
